﻿#region Copyright and License
/*==============================================================================
 *  Copyright (c) www.51mvc.com Corporation.  All rights reserved.
 * ===============================================================================
 * This code and information is provided "as is" without warranty of any kind,
 * either expressed or implied, including but not limited to the implied warranties
 * of merchantability and fitness for a particular purpose.
 * ===============================================================================
 * Licensed under the GNU General Public License (GPL) v2
 * http://www.51mvc.com/
 * Create By 小鱼(Leven)  - http://leven.com.cn
 * ==============================================================================*/
#endregion

using Infancy.Core.Container;

namespace Infancy.Core.Service {
    /// <summary>
    /// 业务逻辑操作层基本实现,大部分业务逻辑类会继承该类
    /// </summary>
    public abstract class ServiceBase : IService {
        #region IService<TEntity> Members

        /// <summary>
        /// 载入数据操作对象
        /// </summary>
        /// <typeparam name="TRepository">对象类型</typeparam>
        /// <returns></returns>
        public TRepository LoadRepository<TRepository>() {
            return ContainerManager.Repository.Resolve<TRepository>();
        }

        /// <summary>
        /// 载入业务逻辑对象
        /// </summary>
        /// <typeparam name="TService">对象类型</typeparam>
        /// <returns></returns>
        public TService LoadService<TService>() {
            return ContainerManager.Service.Resolve<TService>();
        }

        #endregion
    }
}
